//
//  LiuiuCoreData.h
//  SnailPost
//
//  Created by Liuiu on 16/3/16.
//  Copyright © 2016年 抠泥ser. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>

@interface LiuiuCoreData : NSObject

+(LiuiuCoreData *)defaultsCoreDataManager;

//打印路径
-(void)nslogCoreDataPath;

//增
-(void)addWithModelTitle:(NSString *)title cover:(NSString *)cover length:(NSNumber *)length playCount:(NSNumber *)playCount mp4_url:(NSString *)mp4_url;

//查
-(NSArray *)selectModelWithKey:(NSString *)key value:(NSString *)value;//条件查询
-(NSArray *)selectAllModel;//查询全部

//改
-(void)updateModelWithKey:(NSString *)key value:(NSString *)value newValue:(NSString *)newValue;

//删
-(void)deleteModelWithKey:(NSString *)key value:(NSString *)value;


//数据管理器(上下文)
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
//模型管理器
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
//连接器
@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator;
//保存操作
- (void)saveContext;
//返回存储文件路径
- (NSURL *)applicationDocumentsDirectory;

@end
